package com.tjp.eight.ui.fragment.rock;

import com.tjp.eight.AllRetrofit;
import com.tjp.eight.base.BasePresenterImpl;
import com.tjp.eight.constant.UrlConstant;
import com.tjp.eight.net.NetCallBack;
import com.tjp.eight.net.SubscribeCallBack;
import com.tjp.eight.utils.AppUtils;

import okhttp3.RequestBody;

/**
 * Created by Administrator on 2017/5/10.
 */
public class RockPresenter extends BasePresenterImpl<RockViews>{
    RockService  service = AllRetrofit.getRetrofit(UrlConstant.BaseUrl).create(RockService.class);
    public RockPresenter(RockViews views){
        attachView(views);
    }

    public void loadyao(String pjson) {
        RequestBody body = AppUtils.getRequestBody(pjson);
        addSubscription(service.loadyao(body), new SubscribeCallBack<>(new NetCallBack<YaoRModel>() {
            @Override
            public void onSuccess(YaoRModel model) {
                view.loadSuccess(model);
            }

            @Override
            public void onFails(int code, String msg) {
                view.fails(msg);
            }

            @Override
            public void onCompleted() {

            }
        }));
    }
}
